import { App } from 'vue'

export function install(app: App, components: Record<string, any>) {
    // 注册所有组件
    Object.entries(components).forEach(([key, component]) => {
        // 注册连字符形式
        app.component(key, component);

        // 注册大驼峰形式
        const pascalCaseName = key.replace(/-(\w)/g, (_, c) => c.toUpperCase())
            .replace(/^\w/, c => c.toUpperCase());
        app.component(pascalCaseName, component);
    });
}
